#!/usr/bin/env bash
# Max 7z compression

# Set script_dir
script_dir="$(dirname "$(realpath "$0")")"

# Source util function
source "${script_dir}/_util"

ran_col_str "7z Max compression archiver utility uzing lzma2"
cmd_arg_help \
	"Archive name without extension" \
	"Folder name (optional)"

if [ -z "${1}" ]; then
	error_msg "Please provide at least one argument" 1
elif [ -z "${2}" ]; then
	folder_name="${1}"
	error_msg "Please provide at least one argument" 1
	echo -e "${YELLOW}No folder name provided, using ${CYAN}${folder_name}${CLEAR}"
else
	folder_name="${2}"
fi

7z a -m0=lzma2 -mx "${1}.7z" "${folder_name}"
